package com.example.service;

import com.example.entity.Account;
import com.example.entity.Shouhuodizhi;
import com.example.mapper.ShouhuodizhiMapper;
import com.example.utils.TokenUtils;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ShouhuodizhiService {
    @Resource
    ShouhuodizhiMapper shouhuodizhiMapper;
    public void  add(Shouhuodizhi shouhuodizhi) {
            shouhuodizhiMapper.insert(shouhuodizhi);
    }

    public void delete(Integer id) {
        shouhuodizhiMapper.deleteById(id);
    }

    public void update(Shouhuodizhi shouhuodizhi) {
        shouhuodizhiMapper.updateById(shouhuodizhi);
    }

    public List<Shouhuodizhi> selectAll(Shouhuodizhi shouhuodizhi) {
      return  shouhuodizhiMapper.selectAll(shouhuodizhi);
    }

    public PageInfo<Shouhuodizhi> selectPage(Integer pageNum, Integer pageSize, Shouhuodizhi shouhuodizhi) {
        PageHelper.startPage(pageNum, pageSize);
        List<Shouhuodizhi> list = shouhuodizhiMapper.selectAll(shouhuodizhi);
        return PageInfo.of(list);
    }
}
